package com.tongcheng.feign;

import com.tongcheng.ResultDate;
import com.tongcheng.pojo.Activity;
import com.tongcheng.pojo.Activity_coupons;
import com.tongcheng.pojo.Activity_share;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

// 调用一个子服务模块，需要在注解中指定，名字由client的yml文件定义
@FeignClient(value = "tongcheng-client-coupons")
public interface ActivityseviceFeign {
    /*
  这里需要几个要点：
  1.这里定义的路径作用是调用client中的接口
  2.这里的method即是只定义了get，在feign还是会检查client是否允许post请求，如果没有post请求将报错
  3.@RequestParam(value = "name")是绑定controller中的形式参数名，如果没有value属性定义也会报错
   */
    @RequestMapping(value = "/activity/addActivity",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    ResultDate addActivity( @RequestBody Map map);
    @RequestMapping(value = "/activity/delActivity",method = RequestMethod.GET,produces =  MediaType.APPLICATION_JSON_UTF8_VALUE)
    ResultDate delActivity(Integer activity_id);
    @GetMapping(value = "/activity/updateActivity",produces =  MediaType.APPLICATION_JSON_UTF8_VALUE)
    ResultDate updateActivity(@RequestBody Map map);
    @GetMapping(value = "/activity/queryActivity",produces =  MediaType.APPLICATION_JSON_UTF8_VALUE)
    ResultDate queryActivity(Integer activity_id);
    @GetMapping(value = "/activity/queryAllActivity",produces =  MediaType.APPLICATION_JSON_UTF8_VALUE)
    ResultDate queryAllActivity();

}
